 if(!window.DG){
     var DG = {
         confirmed : false
     }; 
 }
 
 DG.confirm = function($message, redirect){
        $message = $message || false;
        redirect = redirect || false;
        if($message !== false){
            
            var markup =  ['<div id="box-confirm-datagrid" title="Sistema - Projects ">',
                           '<div class="well message"><h4>',
                           $message,
                           '</h4><div>',
                           '</div>'].join(' ');
            $('#box-confirm-datagrid').remove();           
            $(markup).appendTo('body').dialog({
                 width:350,
                 height:200,
                 modal:true,
                 draggable:false,
                 buttons:{
                     'Confirmar':function(){
                      $(this).dialog('close');
                       if(redirect !== false){
                             window.location = redirect;
                       }
                     },
                     'Cancelar':function(){
                      $(this).dialog('close');
                        
                     }
                 }
            });
        }
        return DG.confirmed;
    }
    
    DG.closeConfgirm = function(){
        $('#box-confirm-datagrid').dialog('close');
    }
    
 

